﻿#region Copyright (C) Sector7 Software Studio. All rights reserved
/*******************************************************************************************
 * Creation
 *      Author:         Wolf Lai
 *      Date:           2013/6/6 星期四 23:37:46
 *      Version:        
 * Modification 
 *      Author: 
 *      Date: 
 *      Description: 
 *      Version:
 *******************************************************************************************/
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using Sector7.Medical.EntityType;
using Sector7.Framework.DB;
using Sector7.Medical.Consts;
using Sector7.Medical.DAO.Utility;

namespace Sector7.Medical.DAO.Standard
{
    /// <summary>
    /// <!-- The description about this class. -->
    /// </summary>
    public class IdentityTypeDAO : DAOBase<M7_IdentityType>, IIdentityType
    {
        #region Public functions

        /// <summary>
        /// 获取所有证件类型
        /// </summary>
        /// <returns></returns>
        public List<M7_IdentityType> ReadAll()
        {
            string sql = @"
                SELECT *
                    FROM M7_IdentityType
                    WHERE 1 = 1";

            using (DBHelper helper = new DBHelper())
            {
                List<M7_IdentityType> identityTypeList = new List<M7_IdentityType>();

                SqlDataReader reader = helper.ExecuteQuery(sql);
                while (reader.Read())
                {
                    object identityType = new M7_IdentityType();
                    DBUtil.ReadData(reader, identityType);

                    identityTypeList.Add(identityType as M7_IdentityType);
                }

                return identityTypeList;
            }
        }
        #endregion

        #region Structure
        public IdentityTypeDAO()
        {
            m_tableName = "M7_IdentityType";
            m_primaryKeyName = "IdentityTypeId";
        }
        #endregion
    }
}
